﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Restful.Net.Tasks
{
    public static class AsyncExtensions
    {
        public static Task ContinueWith(this IAsyncResult result, Action<IAsyncResult> action)
        {
            Task task = Task.Factory.FromAsync(result, action);

            task.Start();
            return task;
        }

        public static Task<T> ContinueWith<T>(this IAsyncResult result, Func<IAsyncResult, T> func)
        {
            Task<T> task = Task.Factory.FromAsync(result, func);

            task.Start();

            return task;
        }


    }

    public class RequestMachine
    {



    }
}
